package com.kaigejava.springcloud.controller;

import com.kaigejava.springcloud.entities.CommonResult;
import com.kaigejava.springcloud.entities.Payment;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@Slf4j
@RequestMapping("/consumer/")
public class OrderController {
    //这里的地址是zk上面注册服务的名字。和eureka一样
    public  static  final  String PAYMENT_URL = "http://cloud-payment-payment";

    @Autowired
    private RestTemplate restTemplate;

    /**
     * 获取
     *
     * @return
     */
    @GetMapping("getPaymentInfo")
    public String  getPaymentInfo() {

        return restTemplate.getForObject(PAYMENT_URL+"/payment/zk", String.class);   }
}
